package com.cheetah.mapper;

import com.cheetah.entity.OrgRelationship;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

public interface OrgRelationshipMapper {
    @Insert({
        "insert into org_relationship (network_id, org_id, ",
        "leader)",
        "values (#{networkId,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, ",
        "#{leader,jdbcType=VARCHAR})"
    })
    int insert(OrgRelationship record);

    @Select({
        "select",
        "network_id, org_id, leader",
        "from org_relationship"
    })
    @Results({
        @Result(column="network_id", property="networkId", jdbcType=JdbcType.VARCHAR),
        @Result(column="org_id", property="orgId", jdbcType=JdbcType.INTEGER),
        @Result(column="leader", property="leader", jdbcType=JdbcType.VARCHAR)
    })
    List<OrgRelationship> selectAll();
}